package com.demo.mapper;

import com.demo.entity.Carousel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CarouselMapper {

    @Select("select * from carousel order by carousel_id")
    List<Carousel> findAllCarousel();

    @Insert("INSERT INTO carousel\n" +
            "(imgPath, describes)\n" +
            "VALUES( #{imgPath}, '123456');\n")
    int insertCarousel(String imgPath);

    @Delete("DELETE FROM carousel\n" +
            "WHERE carousel_id=#{carouselId};\n")
    int deleteCarousel(int carouselId);
}
